/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.crm.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K950V;
import queenb.web.crm.inteface.K950Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author Thanh Luan
 */
public class K950Store extends K950V implements K950Inf {

    @Override
    public int updateK950By(int pnFK100, int pnPK950,
            String pvKV952, String pvKV953,
            String pvKV954, String pvKV955,
            String pvKV956, String pvKV957,
            int pnFN750, String pvKV958,
            String pvKV959, String pvKV960,
            String pvKV961, String pvKV962,
            String pvKV963, String pvKV964,
            String pvKV965, String pvKV966,
            String pvKV967, String pvKV968,
            String pvKV969, Date pdKD970,
            Date pdKD971, String pvLOGIN) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.UPADATE_K950, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.INTEGER, pnPK950),
                        new Param(OracleTypes.CHAR, pvKV952),
                        new Param(OracleTypes.CHAR, pvKV953),
                        new Param(OracleTypes.CHAR, pvKV954),
                        new Param(OracleTypes.CHAR, pvKV955),
                        new Param(OracleTypes.CHAR, pvKV956),
                        new Param(OracleTypes.CHAR, pvKV957),
                        new Param(OracleTypes.INTEGER, pnFN750),
                        new Param(OracleTypes.CHAR, pvKV958),
                        new Param(OracleTypes.CHAR, pvKV959),
                        new Param(OracleTypes.CHAR, pvKV960),
                        new Param(OracleTypes.CHAR, pvKV961),
                        new Param(OracleTypes.CHAR, pvKV962),
                        new Param(OracleTypes.CHAR, pvKV963),
                        new Param(OracleTypes.CHAR, pvKV964),
                        new Param(OracleTypes.CHAR, pvKV965),
                        new Param(OracleTypes.CHAR, pvKV966),
                        new Param(OracleTypes.CHAR, pvKV967),
                        new Param(OracleTypes.CHAR, pvKV968),
                        new Param(OracleTypes.CHAR, pvKV969),
                        new Param(OracleTypes.DATE, pdKD970),
                        new Param(OracleTypes.DATE, pdKD971),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(dateStatement, K950V.class);
        } catch (SQLException ex) {
            Logger.getLogger(K950Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }

    @Override
    public int deleteK950(int pnFK100, int pnPK950,String pvKV951, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.DELETE_K950, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFK100),
                    new Param(OracleTypes.INTEGER, pnPK950),
                    new Param(OracleTypes.CHAR, pvKV951),
                    new Param(OracleTypes.CHAR, pvLOGIN)});
        try {
            return super.update(dataStatement, K950V.class);
        } catch (SQLException ex) {
            Logger.getLogger(K950Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }

    @Override
    public List<K950V> getListTabK950(int pnFK100, int pnPK950, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_K950, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.INTEGER, pnPK950),
                        new Param(OracleTypes.CHAR, pvLogin)

                    });
            return super.find(dataStatement, K950V.class);
        } catch (SQLException ex) {
            Logger.getLogger(K950Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K950Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K950Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
